<template>

  <div class="container">
    <FmTable ref="fmTable" url="/process/flowable" tableName="listener" :columns="columns" :toolbar="['del','add']">
    </FmTable>
  </div>
</template>

<script lang="ts" setup>
import {fetchData, deteleData,ExportData, saveorUpadateDate,deteleAllData} from '@/api/index';

import {ref, reactive, nextTick, onMounted, getCurrentInstance, ComponentInternalInstance} from 'vue';
import {LoadDict} from "@/utils/dict";
import {ElMessage, ElMessageBox, FormInstance} from "element-plus";
import {useRouter} from "vue-router";
const columns=[
  {
    "label": "监听编号",//标签名称
    "index": "id",//数据库索引
    "rules": [
      {required: true, message: "请输入主键", trigger: "blur",},
    ],//值规则
    "search": true,//是否是搜索表单
    "dataType": "text",//值值类型默认字符类型
    "addable":false
  },
  {
    "label": "名称",//标签名称
    "index": "name",//数据库索引
    "rules": [
      {required: true, message: "请输入主键", trigger: "blur",},
    ],//值规则
    "search": true,//是否是搜索表单
    "dataType": "text",//值值类型默认字符类型
  },
  {
    "label": "监听类型",//标签名称
    "index": "type",//数据库索引
    "rules": [
      {required: true, message: "请输入主键", trigger: "blur",},
    ],//值规则
    "dataType": "text",//值值类型默认字符类型
  },
  {
    "label": "事件类型",//标签名称
    "index": "eventType",//数据库索引
    "rules": [
      {required: true, message: "请输入主键", trigger: "blur",},
    ],//值规则
    "dataType": "text",//值值类型默认字符类型
  },
  {
    "label": "执行类型",//标签名称
    "index": "valueType",//数据库索引
    "rules": [
      {required: true, message: "请输入主键", trigger: "blur",},
    ],//值规则
    "dataType": "text",//值值类型默认字符类型
  },
  {
    "label": "执行内容",//标签名称
    "index": "value",//数据库索引
    "rules": [
      {required: true, message: "请输入主键", trigger: "blur",},
    ],//值规则
    "dataType": "text",//值值类型默认字符类型
  },
  {
    "type": "opt",//普通行，字典行，自定义行
    "label": "操作",//标签名称
    "index": "opt",//数据库索引
    "rules": [],//值规则
    "width":150,
    "dataType": "text",//值值类型默认字符类型
  }
]
let fmTable = ref()
const router = useRouter()
const handleUpdateSuspensionState = (row:any) => {
  let state = 1;
  if (row.suspensionState === 1) {
    state = 2
  }
  const params = {
    deployId: row.deploymentId,
    state: state
  }
  saveorUpadateDate("",params).then(res => {
    ElMessage.success(res);
    fmTable.value.readyGetData
  });
}
const handleLoadXml = (row:any) => {
  router.push({ path: '/admin/flowable/model',query: { deployId: row.deploymentId }})
}
</script>
